<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="public/css/default.css">
    <title>Document</title>
</head>
<body>
    <% include header.html %>
    <h2>现在由<%=id%> 好技师为你服务</h2>
    <h3>你好，是<%=name%>,今年 <%=age%>，会 <%=skills%></h3>
    <br/>
    获取到的session <%=username%>
    <br/>
    <br/>
    application 扩展获取方法 <%=newTime%> 
    <br/>
    application 扩展获取属性 <%=newTimeProperty%>
    <br/>
    <br/>
        处理服务端cookie 
        <button onclick="add()">增加</button>
        <button onclick="del()">删除</button>
        <button onclick="editor()">修改</button>
        <button onclick="show()">查看</button>
    <br/>
    我的技能是：
    <ol>
        <% for(var i=0;i<skills.length;i++){%>
        <li><%=skills[i] %></li>
        <%}%>
    </ol>

    <script>
        //有安全策略 用post 请求, 对服务短cookie进行处理
        function add(){
            fetch('/addCookie',{
                method:"post",
                headers:{
                    "Content-type":"application/json"
                }
            })
        }

        function del(){
            fetch('/delCookie',{
                method:"post",
                headers:{
                    "Content-type":"application/json"
                }
            })
        }

        function editor(){
            fetch('/editorCookie',{
                method:"post",
                headers:{
                    "Content-type":"application/json"
                }
            })
        }

        function show(){
            fetch('/showCookie',{
                method:"post",
                headers:{
                    "Content-type":"application/json"
                }
            })
        }
    </script>
</body>
</html>